/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements.  See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


/*************************************************************************
 *\author: starlove
 *************************************************************************/
#ifndef __CC_PYTHON_IMPORT_O_TOUCH_IMPL__
#define __CC_PYTHON_IMPORT_O_TOUCH_IMPL__

#include "python_object_touch.h"
#include "python_object_image.h"

NS_CCPY_BEGIN
	PYCLASS_INIT_AND_BASE(CPyTouch, CPyCCObject, "CCTouch", "Python CCTouch Object");
	PYCLASS_BEGIN_METHOD_DEF(CPyTouch)
		PYCLASS_ADD_METHOD(CPyTouch, setTouchInfo)
	PYCLASS_END_METHOD_DEF(CPyTouch)
	PYCLASS_BEGIN_GETSET_DEF(CPyTouch)
		PYCLASS_ADD_GET(CPyTouch, Location)
		PYCLASS_ADD_GET(CPyTouch, PreviousLocation)
		PYCLASS_ADD_GET(CPyTouch, StartLocation)
		PYCLASS_ADD_GET(CPyTouch, Delta)
		PYCLASS_ADD_GET(CPyTouch, LocationInView)
		PYCLASS_ADD_GET(CPyTouch, PreviousLocationInView)
		PYCLASS_ADD_GET(CPyTouch, StartLocationInView)
		PYCLASS_ADD_GET(CPyTouch, ID)
	PYCLASS_END_GETSET_DEF(CPyTouch)
	PYCLASS_IMP_INTERFACE_NEW(CPyTouch)

	int CPyTouch::__init__(CPyTouch *pySelf, PyObject *args, PyObject *kwds)
	{
		pySelf->setRaw();
		return 0;
	}

	void CPyTouch::__del__(CPyTouch *self)
	{
		self->ob_type->tp_free(self);
	}

	PYCLASS_METHOD_IMPL(CPyTouch, setTouchInfo)
	{
		int id = 0;
		float x = 0;
		float y = 0;
		if( !PyArg_ParseTuple(pyArgs, "iff", &id, &x, &y) )
			Py_RETURN_NONE;		
		CC_METHOD_WRAPPER_SETER(cocos2d::CCTouch *, CPyTouch, setTouchInfo, id, x, y);
		Py_RETURN_NONE;
	}

	PYCLASS_GET_IMPL(CPyTouch, Location)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getLocation, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, PreviousLocation)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getPreviousLocation, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, StartLocation)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getStartLocation, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, Delta)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getDelta, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, LocationInView)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getLocationInView, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, PreviousLocationInView)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getPreviousLocationInView, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, StartLocationInView)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getStartLocationInView, cocos2d::CCPoint);
		CPyPoint *pt = CPyPoint::create(v);
		return (PyObject *)pt;
	}

	PYCLASS_GET_IMPL(CPyTouch, ID)
	{
		CC_METHOD_WRAPPER_GETER(cocos2d::CCTouch *, CPyTouch, getID, int);
		return Py_BuildValue("i", v);
	}
	

NS_CCPY_END

#endif